package com.weiyuwqj.web;

import com.alibaba.dubbo.rpc.Filter;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.Result;
import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.dubbo.rpc.RpcException;
import com.weiyuwqj.api.util.IpUtils;

/**
 * Created by huzj on 2017/5/3.
 */
public class CilentInfoFilter implements Filter {

    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        RpcContext.getContext().setAttachment("ip", IpUtils.get());
        RpcContext.getContext().setAttachment("client", "web");
        Result result = invoker.invoke(invocation);
        return result;
    }

}
